package com.vv.api_manage.controller;

import com.vv.api_manage.entity.ApiInterfaceVO;
import com.vv.api_manage.service.IApiInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;

/**
 * @Description
 * @Author xingchao
 * @Date 2020/12/31 16:28
 */

@RestController
@RequestMapping("/api")
public class ImportApiCtrl {

    @Autowired
    private IApiInterface iApiInterface;

    @RequestMapping("/import")
    @ResponseBody
    public Map<String,Object> importApi(MultipartFile file){
        Map<String,Object> map = iApiInterface.importApi(file);
        return map;
    }

    @RequestMapping("/addApi")
    @ResponseBody
    public Map<String,Object> addApi(ApiInterfaceVO interfaceVO){
        Map<String,Object> map = iApiInterface.addApi(interfaceVO);
        return map;
    }

    @RequestMapping("/updateApi")
    @ResponseBody
    public Map<String,Object> updateApi(ApiInterfaceVO interfaceVO){
        Map<String,Object> map = iApiInterface.updateApi(interfaceVO);
        return map;
    }

}
